﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using cecbClasses.Data_Classes;
using System.IO; 



namespace CECB
{
    /// <summary>
    /// Interaction logic for ExcelRead_Window.xaml
    /// </summary>
    public partial class ExcelRead_Window : Window
    {
        private String filePath;

        public ExcelRead_Window()
        {
            InitializeComponent();
             
            
        }

        public void RE(String fpath)
        { 
            cecbClasses.Data_Adapters.Excel.ReadExcel re = new cecbClasses.Data_Adapters.Excel.ReadExcel();
            re.excel_init(filePath);
            
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName = "Document"; // Default file name 
            dlg.DefaultExt = ".xlsx"; // Default file extension 
            dlg.Filter = "Excel documents (.xlsx)|*.xlsx"; // Filter files by extension 

            // Show open file dialog box 
            Nullable<bool> result = dlg.ShowDialog();

            // Process open file dialog box results 
            if (result == true)
            {
                // Open document 
                filePath = dlg.FileName;
            }

            MessageBox.Show(filePath);
            
             cecbClasses.Data_Adapters.Excel.ReadExcel re = new cecbClasses.Data_Adapters.Excel.ReadExcel();
             //re.excel_init(filePath);
        //     MessageBox.Show( new cecbClasses.Data_Adapters.Excel.ReadExcel().getAllActivities().Count.ToString());
         //    MessageBox.Show(new cecbClasses.Data_Adapters.Excel.ReadExcel().getAllImpacts().Count.ToString());
             MessageBox.Show(new cecbClasses.Data_Adapters.Excel.ReadExcel().getValues(filePath).Count.ToString());

           // RE(filePath);
        }


        


        


    }
}
